Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot access setup.py: No such file or directory" - can't run any .py files?

Tags:

This problem started while I was installing pyswip and needed to run a setup.py file. Using the command "python setup.py", I'm greeted with the following message: "python: can't open file 'setup.py': [Errno 2] No such file or directory."

I know this question's been asked a lot before, so I've tried everything in previous answers. Including #!/usr/bin/env python or #!/usr/bin/env python-3.3.0 at the very top of the script and then trying "chmod +x setup.py" gives the following: "chmod: cannot access setup.py': No such file or directory".

Trying to run other .py files from the terminal gives the same result.

Running the file in the Python Shell from IDLE doesn't do anything.

Running the "ls -d */" command shows that the Python-3.3.0/ directory, where the .py files in question are, is definitely there.

Am I missing something really obvious? (If it helps, I have Elementary OS 0.2.)

like image 531
acaciarose Avatar asked Jul 30 '14 12:07

acaciarose


People also ask

How do I run python setup py?

To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

How do I test a setup py file?

If you really want isolation instead just doing python setup.py install in virtualenv. Then use virtualbox and install some free linux os in it. Take a snapshot of the machine after the install so you can revert easily with one click to the starting point at any time and try python setup.py install there.

What does setup py do?

The setup.py is a Python script typically included with Python-written libraries or apps. Its objective is to ensure that the program is installed correctly. With the aid of pip , we can use the setup.py to install any module without having to call setup.py directly. The setup.py is a standard Python file.


2 Answers

When you run python setup.py that requires the setup.py file to be in the current directory.

You can control the current directory with the cd command.

So:

cd /home/acacia/Python-3.3.0/PySwip/pyswip-0.2.3 python setup.py install 
like image 87
Charles Duffy Avatar answered Oct 04 '22 11:10

Charles Duffy


I have no knowledge about Elementary OS but you could try to use the full path of the setup.py.

python /home/acacia/Python-3.3.0/PySwip/pyswip-0.2.3/setup.py install 

[EDIT] Can't answer comments, so I just added the install parameter in my answer

like image 40
Kuishi Avatar answered Oct 04 '22 12:10

Kuishi