简体   繁体   中英

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

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.)

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

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

You need to go into the directory that you are going to "setup". For example, if you are installing numpy, and you have git-cloned it, then it probably is located at ~/numpy. So first cd into ~/numpy, and the type the commend like "python setup.py build" there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM